import request from '@/utils/request'

// 添加账号密码
export function addAccount(data) {
  return request({
    url: '/account/add',
    method: 'post',
    params: data
  })
}

// 修改账号密码
export function updateAccount(data) {
  return request({
    url: '/account/update',
    method: 'post',
    params: data
  })
}

// 删除账号密码
export function deleteAccount(id) {
  return request({
    url: '/account/delete',
    method: 'post',
    params: {
      id
    }
  })
}

// 获取账号密码详情
export function getAccountDetail(id) {
  return request({
    url: '/account/detail',
    method: 'get',
    params: {
      id
    }
  })
}

// 分页查询账号密码
export function getAccountList(params) {
  return request({
    url: '/account/page',
    method: 'get',
    params
  })
}

// 生成随机密码
export function generatePassword(length = 12) {
  return request({
    url: '/account/generatePassword',
    method: 'get',
    params: {
      length
    }
  })
} 